/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.yandex.skipass;

/**
 *
 * @author Neophron
 */
public class PassCreator {

    public Pass createPass(int id, PassType passType, Enum arg) {
        try {
            switch (passType) {
                case SEASON:
                    return SeasonPass.createSeasonPass(id, (Seasons) arg);
                case WORKDAYCOUNT:
                    return WorkDayCountPass.createWorkDayCountPass(id,
                            (TripCount) arg);
                case DAYOFFCOUNT:
                    return DayOffCountPass.createDayOffCountPass(id,
                            (TripCount) arg);
                case DAYOFFDAY:
                    return DayOffDayPass.createDayOffDayPass(id,
                            (DayCount) arg);
                case WORKDAYDAY:
                    return WorkDayDayPass.createWorkDayDayPass(id,
                            (DayCount) arg);
                default:
                    throw new IllegalArgumentException();
            }
        } catch (ClassCastException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }

}
